import variables from '@/styles/element-variables.scss'
import defaultSettings from '@/settings'
import store from '@/store'
const { showSettings, sidebarLogo,layoutType } = defaultSettings


const state = {
  theme: variables.theme,
  showSettings: showSettings,
  tagsView: true,
  fixedHeader: true,
  sidebarLogo: sidebarLogo,
  showNotification:false,
  noticeTip:false,
  layoutType:layoutType, // 布局结构：top / mix / side
}

const mutations = {
  CHANGE_SETTING: (state, { key, value }) => {
    // eslint-disable-next-line no-prototype-builtins
    if (state.hasOwnProperty(key)) {
      state[key] = value
    }
  },
  CHANGE_NOTIFICCATION: (state, { key, value }) => {
    // eslint-disable-next-line no-prototype-builtins
    if (state.hasOwnProperty(key)) {
      state[key] = value
    }
  },
  CHANGE_NOTICTIP: (state, { key, value }) => {
    // eslint-disable-next-line no-prototype-builtins
    if (state.hasOwnProperty(key)) {
      state[key] = value
    }
  }
}

const actions = {
  changeSetting({ commit }, data) {
    commit('CHANGE_SETTING', data)
  },
  changeNotification({ commit }, data) {
    commit('CHANGE_NOTIFICCATION', data)
  },
  changeNoticTip({ commit }, data) {
    commit('CHANGE_NOTICTIP', data)
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

